<template>
  <div class="card content-box">
    <span class="text">用户情感分析</span>
    <!--展示情感分析列表-->
    <el-table :data="petitions" style="width: 100%">
      <el-table-column label="序号" width="100" type="index"> </el-table-column>
      <el-table-column label="信访人" prop="userID"></el-table-column>
      <el-table-column label="主题" prop="title"></el-table-column>
      <el-table-column label="一级分类" prop="typeName"></el-table-column>
      <el-table-column label="情感" prop="sentiment"></el-table-column>
      <el-table-column label="部门" prop="petitionDep"></el-table-column>
      <el-table-column label="状态" prop="statusName"></el-table-column>
      <template #empty>
        <el-empty description="空空如也" />
      </template>
    </el-table>
    <el-card style="width: auto" shadow="always" class="textbox">
      <p>0-1情感程度近0优先处理</p>
    </el-card>
  </div>
</template>

<script setup lang="ts" name="columnChart">
//用户情感分析表格
import { getAllDetailService } from "@/api/core/funcs";
import { onMounted } from "vue";
import { ref } from "vue";

//数据模型
const statusList = ["已提交", "待审核", "已审核", "待处理", "已处理"];
const categories = [
  "农村农业",
  "国土资源",
  "城乡建设",
  "劳动和社会保障",
  "卫生计生",
  "教育文体",
  "民政",
  "政法",
  "经济管理",
  "交通运输",
  "商贸旅游",
  "科技与信息产业",
  "环境保护",
  "党务政务",
  "组织人事",
  "纪检监察",
  "其他"
];
const petitions = ref([
  {
    eventID: 1,
    eventType: 1,
    typeName: "",
    userID: 10000000,
    title: "关于程序员每天996的问题",
    description: "hhh",
    petitionDep: "重庆市江北区信访办",
    status: 1,
    statusName: "",
    createdAt: "2024-07-11 20:11:12",
    filePath: "http://www.baidu.com",
    keywords: null,
    workId: null,
    sentiment: 0.06916084606459039,
    degree: 5.0
  }
]);

const getData = async () => {
  let result = await getAllDetailService();
  petitions.value = result.data;
  for (let i = 0; i < petitions.value.length; i++) {
    petitions.value[i].statusName = statusList[petitions.value[i].status];
    petitions.value[i].typeName = categories[petitions.value[i].eventType];
  }
};

onMounted(getData);
</script>

<style scoped lang="scss">
@import "./index";
.textbox {
  float: left;
  color: orange;
  font-weight: 600;
  position: absolute;
  top: 15%;
  left: 80%;
}
</style>
